import service from "@/utils/request";

interface ICategory {
  id: number;
  name: string;
}
export interface ILevel1Category extends ICategory {}

export interface ILevel2Category extends ICategory {
  category1Id: number;
}
export interface ILevel3Category extends ICategory {
  category2Id: number;
}

//获取一级分类数据
export function requestCategory1() {
  return service.get<any, ILevel1Category[]>("/product/getCategory1");
}

/**
 * 获取二级分类数据
 */
export function requestCategory2(category1Id: number) {
  return service.get<any, ILevel2Category[]>(
    `/product/getCategory2/${category1Id}`
  );
}

/**
 * 获取三级分类数据
 */
export function requestCategory3(category2Id: number) {
  return service.get<any, ILevel3Category[]>(
    `/product/getCategory3/${category2Id}`
  );
}
